package com.btpn.infra.utils;

import java.util.regex.Pattern;

public class MyRegexValidator {

    private static final String PATTERN_EMAIL =
            "^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
    private static final String PATTERN_USERNAME = "^[a-z0-9_-]{5,20}$";
    private static final String PATTERN_PASSWORD = "((?=.*\\d)(?=.*[a-z]).{5,20})";

    public static boolean validateEmail(final String hex) {
        return Pattern.compile(PATTERN_EMAIL).matcher(hex).matches();
    }
    
    public static boolean validateUsername(final String hex) {
        return Pattern.compile(PATTERN_USERNAME).matcher(hex).matches();
    }
    
    public static boolean validatePassword(final String hex) {
        return Pattern.compile(PATTERN_PASSWORD).matcher(hex).matches();
    }
}
